import GObject from 'gi://GObject';
import Gtk from 'gi://Gtk?version=4.0';
+import {formatError} from './misc/errorUtils.js';
+
export const ExtensionPrefsDialog = GObject.registerClass({
GTypeName: 'ExtensionPrefsDialog',
Signals: {
this._revealer.connect('notify::child-revealed',
() => this._syncExpandedStyle());
- this._errorView.buffer.text = `${error}\n\nStack trace:\n`;
- // Indent stack trace.
- this._errorView.buffer.text +=
- error.stack.split('\n').map(line => ` ${line}`).join('\n');
+ const formattedError = formatError(error);
+ this._errorView.buffer.text = formattedError;
// markdown for pasting in gitlab issues
let lines = [
`The settings of extension ${this._uuid} had an error:`,
'```',
- `${error}`,
- '```',
- '',
- 'Stack trace:',
- '```',
- error.stack.replace(/\n$/, ''), // stack without trailing newline
+ formattedError.replace(/\n$/, ''), // remove trailing newline
'```',
'',
];
<file>extensions/prefs.js</file>
<file>misc/config.js</file>
+ <file>misc/errorUtils.js</file>
<file>misc/extensionUtils.js</file>
<file>misc/dbusUtils.js</file>
<file>misc/params.js</file>